Fixing my SSAO with hot reloading shaders
Been just messing around and got the physics engine back up and running in the new renderer.
Its pretty sweet!
Except for... just one little issue...
Ok that's clearly wrong. This amount of shadowing tells me that my SSAO samples are clearly facing the wrong direction.
Honestly one of the best things you can do at this point is to crack open renderdoc and see what's going on. But I already had the game running and I didn't feel like re-opening the game.
So what we can do instead is just modify the hlsl directly to output some of stuff we're interested in.
Ok so, if the SSAO samples are facing the wrong direction then the normals are likely what's broken.
so we can output the normal values directly to the ssao image. Then output those colors directly to the output
Ruh roh...
to actually be more green when facing up. but watching it move in this state is kinda cool, its clear to see that the normals are actually just rotating with the object itself. This likely means that when I'm outputting the normals to my normal texture, the value is not being properly rotated along with the object before being converted into screen space.
This is my entire vertex shader.
So ScreenNormal theoretically should be the normal of the vertex, with the view matrix applied to it.
and yeah i can clearly see..
I wrote noTranslateScreen but ended up not using it, instead using the old NoTranslateView matrix instead. wonder if HLSL has warnings for unused variables.
There's some easy fixes.
a bunch of these crates are now rotated in all different orientations and the SSAO now works as intended!